<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	  xmlns:h="http://java.sun.com/jsf/html"
	  xmlns:f="http://java.sun.com/jsf/core"
	  xmlns:ui="http://java.sun.com/jsf/facelets"
	  xmlns:c="http://java.sun.com/jstl/core"
	  xmlns:p="http://primefaces.org/ui"
	  lang="pt-br">
    <body>
        
<ui:composition template="template/template.xhtml">
            
	<ui:define name="titulo">
		Detalhes do produto
	</ui:define>

	<ui:define name="conteudo">
		<p:panel header="Detalhes do produto">
		
			<h:panelGrid columns="2" cellpadding="2" 
				rendered="#{lojaController.detalhes.prodNome ne null}">
				<h:panelGrid columns="1">
			      	
					<h:graphicImage 
						value="/thumbs/#{lojaController.detalhes.imagem}" />
			    </h:panelGrid>
			    <h:panelGrid>
				    <h:outputText 
			      		value="#{lojaController.detalhes.prodNome}" 
			      		styleClass="title">
				    </h:outputText>
				    <h:panelGroup>
				      <h:outputText 
				      		value="#{lojaController.detalhes.desconto > 0 ? 'Lista:':'Preco:'}" 
				      		styleClass="text"/>
				      <h:outputText value="#{lojaController.detalhes.preco}"  
				      		styleClass="#{lojaController.detalhes.desconto > 0 ? 'listprice':'text'}">
					    <f:convertNumber type="currency"/>
				      </h:outputText>
				    </h:panelGroup>
				    <h:panelGroup rendered="#{lojaController.detalhes.desconto>0}">
				      <h:outputText value="Preco:" styleClass="text"/>
				      <h:outputText 
				      		value="#{lojaController.detalhes.preco-(lojaController.detalhes.preco*lojaController.detalhes.desconto)/100}"  
				      		styleClass="price">
					    <f:convertNumber type="currency"/>
				      </h:outputText>
				    </h:panelGroup>
				     <h:panelGroup rendered="#{lojaController.detalhes.desconto>0}">
				      <h:outputText value="Economize:" styleClass="text"/>
				      <h:outputText 
				      		value="#{(lojaController.detalhes.preco*lojaController.detalhes.desconto)/100}"  
				      		styleClass="price">
					    <f:convertNumber type="currency"/>
				      </h:outputText>
				    </h:panelGroup>
				    <h:panelGroup>
				      <h:outputText value="Categoria:" styleClass="text"/>
				      <h:outputText value="#{lojaController.detalhes.cat.catNome}" 
				      	styleClass="text"/> 
				    </h:panelGroup>
					<h:commandLink action="#{carrinhoController.adicionarAoCarrinho}">
					  <h:outputText value="Adicionar ao carrinho"  styleClass="text"/>
					  <f:param name="id" value="#{lojaController.detalhes.id}"/>
					</h:commandLink>
			     </h:panelGrid>
			</h:panelGrid>	
			<h:panelGroup>
		      <h:outputText 
		      		value="#{lojaController.detalhes.descGd}" 
		      		styleClass="text">
		      </h:outputText>
		    </h:panelGroup>  
		
		</p:panel>
		
		<div id="products">
			
   		</div>
	</ui:define>

</ui:composition>
        
    </body>
</html>
